﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMing.Core.IO
{
    public class Path
    {
        /// <summary>
        /// 处理相对路径
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string GetApplicationPath(string path)
        {
            path = path.Replace("/", "\\");
            if (path.Contains(":"))
            {
                return path;
            }
            string appPath = System.Environment.CurrentDirectory;
            if (string.IsNullOrEmpty(path))
            {
                return appPath;
            }
            path = string.Format("{0}{2}{1}", appPath, path, path.Substring(0, 1) != "\\" ? "\\" : "");

            return path;
        }
    }
}
